﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace OwElectrePromethee
{
    public class EWariant
    {
        public EWariant(){}

        public EWariant(int id, string name,  params double[] kryterium)
        {
            Id = id;
            K = new List<EKryteriumW>();

            int counter = 1;
            foreach (var k in kryterium)
            {
                K.Add(new EKryteriumW(counter++, k));
            }

            Name = name;
        }

        public EWariant(int id, params double[] kryterium)
        {
            Id = id;
            K = new List<EKryteriumW>();

            int counter = 1;
            foreach (var k in kryterium)
            {
                K.Add(new EKryteriumW(counter++, k));
            }

            Name = String.Format("W{0}", id);
        }

        public string Name { get; set; }

        public int Id { get; set; }

        public List<EKryteriumW> K { get; set; }

        public override string ToString()
        {
            return String.Format("{0}:{1}, {2}", Id, Name, K.Aggregate("", (current, k) => current + (k.ToString() + ", ")));
        }
    }

    public class EKryteriumW
    {
        public EKryteriumW()
        {
        }

        public EKryteriumW(int id, double value)
        {
            Id = id;
            Value = value;
        }

        [Description("Id kryterium")]
        public int Id { get; set; }

        [Description("Wartość kryterium")]
        public double Value { get; set; }

        public override string ToString()
        {
            return String.Format("{0}: {1}", Id, Value);
        }
    }

    public class EWariantyList
    {
        public EWariantyList()
        {
            this.List = new List<EWariant>();
        }

        public List<EWariant> List { get; set; }
    }
}
